AN006 - Example of using and calibrating the HEAD2 device

In this section we want to describe the first steps that will make the first approach to the HEAD2 device.
We can divide in the following sections, the proceed of the operation:

Device declaration in the configuration unit

As was already explained in the description of the device, you must program properly the configuration unit of application. It is very important to the piece of code that declares the device, here you should indicate the hardware resources to be used to ensure proper operation. It will be the responsibility of the programmer to pick and choose the most appropriate inputs and outputs. For example with the following line of code:

;--------------------------------- 
; Internal device declaration 
;--------------------------------- 
INTDEVICE 
Heads HEAD2 0002 2.CNT01 3.INP01 X.X X.X 3.OUT01 3.OUT02 3.OUT03 3.OUT04 X.X X.X X.X X.X

You define an HEAD2 device with “Heads” name with sampling time to 2 ms. Have been declared the following hardware resources: the input to the bidirectional counter has 2.CNT01 address (where 2 indicates the slot seat clamp identification while CNT01 is the mnemonic name of the input), the digital input on the piece presence sensor 3.INP01 (the remaining two entries have been omitted which may be used by sensors for power factor correction of the position of the workpiece) and four digital outputs that will command the machine sanding heads.

An application that has just inside the device declaration in the configuration unit and a qcl unit that it does not run anything (except WAIT forced) already allows to perform the first operations using the device capabilities. In fact, after you download the application on the instrument and having done work, it can change the parameters, observe the states or give commands to devices using the appropriate monitor from QView.
This is very convenient in the early stages of planning When you just want to make some runs or being debugged.
Ensure that the device operates properly however, some parameters that are configured correctly carrying out a proper calibration to adapt the capabilities of the instrument to the physical issues of the machine.

Correct device parameterization

At this point it is worth recalling how could a machine controlled by the HEAD device: a conveyor belt allows you to move material below some machining heads, This is connected to an encoder that allows the tool to know his speed. It should be noted that this speed is only measured and that there is no control of axis movement.
At the beginning of the tape is usually placed a sensor (optical or mechanical) that determines the presence and length of a piece of material to be processed, it is possible also to use more two sensors at different distances in order to verify the presence of the piece.
The heads are controlled using the digital outputs.

As you can deduce from the declaration line device they identify three basic elements that are controlled by device:

Calibration for the measurement of the speed tape

Measure and pulse introduction

Let us consider the case (widespread) where the bi-directional transducer is a digital encoder directly keyed on the roller axis that moves the tape. You will need to set the correctly measure and pulse parameters of the device so that it can interpret the pulses arriving at QMove, the instrument then you can calculate the speed of the axis.
The measure and pulse introduction establishes a correspondence between a space in a unit of your choice and a certain number of pulses. In the event that the user already knows the space covered in a round encoder then you'll proceed directly to projecting values.
Let's clarify this concept with an example: If the encoder emits 1000 pulses/Rev and you know that the axis moves about 5 cm When the encoder performs exactly one lap then you can insert the following values:

AxisX:measure = 50;
AxisX:pulse = 4000

The measure value introduced It also involves choosing a unit of measure of mm for measuring the positions, in the pulse parameter Yes it's introduced a value equal to the number of pulses is multiplied for 4. Remember that the measure/pulse relationship must be a value between 0.00935 to 1. It is important to emphasize that the values described above are taken as reference: It is not necessary to introduce the parameters with reference to an encoder revolution as we will describe below.

When the user does not know in advance the measurement parameters, will still be able to make the correct calibration by following these steps:

The encoder resolution is now correctly set.

Calculation of belt speed

The device, to calculate the speed at which it moves the tape, count the number of pulses received from the encoder for a short period of time (sampling time), dividing that value for the duration of the interval you get the average speed within the period.
The tbf parameter allows you to choose the length of sampling time, was given this possibility to the user because, in the event that the tape moves at very low speed you will have to set a long time. Otherwise it could happen that in sampling time you do not receive sufficient samples to determine the speed.
It is recalled that, a long sampling time involves a rather slow speed update.

Was introduced also a filter software that can be used in the calculation of the band speed. This filter is lowpass and its time constant can be set with the tfilter parameter, You can also choose whether to enable this filter when the belt speed undergoes a change in a sample time exceeds a certain parameter. This parameter is set through dvelf. This filter returns to avoid a measured value of speed that oscillate too, It can be said that its function is to “mediate” the calculated speed.

The unit of measurement of the instantaneous speed of the tape is chosen through unitvel and decpt parameters. You can select the unit of time of speed with unitvel parameter: if this is equal to 0 then the speed is measured in Um/min, if is equal to 1 then the speed is measured in Um/s. The decpt parameter instead determines whether multiple speed-measuring of fundamental units Um. For example, if the fundamental unit of measure is Um=mm, and unitvel=1 you get the speed indicator in the vel in:
mm/s (with decpt = 0),
cm/s (with decpt = 1),
dm/s (with decpt = 2),
m/s (with decpt = 3).
Later, if needed, we must properly configure the display to adjust the correct decimal point position.

Calibrating presence piece sensor

The presence piece sensors have fixed positions in machine configuration: the first, at the start of the conveyor, has the task to identify the beginning and end of the piece, possibly can be used two other sensors placed at a certain distance from the beginning of the tape to make a “correction” of the position of the workpiece.
The disti02 and disti03 parameters allow you to set the distance from the sensors to 2 and 3 from first.

The first sensor will also identify the beginning of the conveyor, whenever this will activate the posit parameter and encoder is reset.
In case the sensor piece is a mechanical limit switch It may be necessary to introduce an advance or delay the end of piece than the falling edge of the signal. This can be set with the offseti01 parameter.
The beltlength parameter allow sets the length of the tape, the device when will identify the presence of material will keep blower output.

Setup teste di lavorazione

La modalità per configurare le teste di lavorazione si discosta dalla semplice introduzione di un valore in un parametro. Infatti è necessario utilizzare degli appositi comandi (WRITESET, WRITEPRG e WRITEVAR), questo è dovuto all'implementazione interna del device.
I primi parametri da introdurre saranno quelli tramite il comando WRITESET:
dist determina la distanza tra il primo sensore presenza pezzo e il centro della testa di lavoro in questione,
mode consente di determinare la funzione che dovrà svolgere la testa,
i parametri riseadv e downlag configurano gli anticipi/ritardi di salita/discesa teste con la modalità descritta nel manuale del device.

La procedura per introdurre i parametri è la seguente:

[...]
Teste:headin = 2                       ;configurazione della testa 2
Teste:dist = 100                       ;distanza impostata a 100 Um dal sensore presenza pezzo
Teste:mode = 1                         ;testa impostata come levigatrice
Teste:riseadv1 = 5                     ;impostazione dell'anticipo salita testa legato alla velocità correvel1
Teste:riseadv2 = 7                     ;impostazione dell'anticipo salita testa legato alla velocità correvel2
Teste:riseadv3 = 10                    ;impostazione dell'anticipo salita testa legato alla velocità correvel3
Teste:downlag1 = 6                     ;impostazione del ritardo discesa testa legato alla velocità correvel1
Teste:downlag2 = 8                     ;impostazione del ritardo discesa testa legato alla velocità correvel2
Teste:downlag3 = 12                    ;impostazione del ritardo discesa testa legato alla velocità correvel3
Teste:headout = 0                      ;imposto headout a 0
WRITESET Teste                         ;invio comando di scrittura
WAIT Teste:headout EQ Teste:headin     ;attesa comando eseguito
[...]

Questa procedura (scelta della testa da impostare con il parametro headin, modifica dei parametri, invio del comando) va effettuata anche quando si utilizzano i comandi di lettura e scrittura WRITEPRG, READPRG, WRITEVAR, READVAR.

Tramite WRITEPRG è possibile inserire le configurazioni relative alla modalità di lavorazione della testa.

WRITEVAR invece consente di leggere dei parametri relativi alla lavorazione in corso.
Lo stesso meccanismo di lettura dei parametri funziona con il comando READPIECE che consente di conoscere delle informazioni su uno specifico pezzo in lavorazione.

Quando si desidera leggere continuamente i valori dei parametri relativi a tutte le teste, si può semplicemente utilizzare un ciclo for per leggere e memorizzare in un array i parametri a cui si è interessati:

[...]
FOR (gbCount=1, gbCount LE 8, 1)      ;inizializzazione ciclo for
  Teste:headin = gbCount              ;configuro tutte le teste da 1 a 8
  Teste:dist = gbCount * 10           ;teste equispaziate di 10 Um
  Teste:mode = 1                      ;tutte teste levigatrici
  WRITESET Teste                      ;invio comando di scrittura
  WAIT Teste:headout EQ Teste:headin  ;attesa comando eseguito
NEXT
[...]
[...]
FOR (gbCount=1, gbCount LE 8, 1)      ;inizializzazione ciclo for
  Teste:headin = gbCount              ;configuro tutte le teste da 1 a 8
  READVARSET Teste                    ;invio comando di lettura
  WAIT Teste:headout EQ Teste:headin  ;attesa comando eseguito
  Teste:actriseadv = garray[1]        ;memorizzo la correzione di anticipo nella prima posizione di un array
  Teste:actdownlag = garray[2]        ;memorizzo la correzione di ritardo nella seconda posizione di un array
  Teste:actpiece = garray[3]          ;memorizzo il numero del pezzo in lavorazione nella terza posizione di un array
NEXT
[...]